package edu.tongji.structureplayer.structure
{
    public class Constrain extends BaseStructure
    {
        private var _node:Node;
        private var _connection:Connection;
        private var _theta:Number;
        
        public function Constrain(name:String, node:Node, conn:Connection, theta:Number)
        {
            super(name);
            _node = node;
            _connection = conn;
            _theta = theta;
        }
        
        public function overlap(node:Node):Boolean
        {
            return node == _node;
        }
        
        public function get node():Node
        {
            return _node;
        }

        public function set node(value:Node):void
        {
            _node = value;
        }

        public function get connection():Connection
        {
            return _connection;
        }

        public function set connection(value:Connection):void
        {
            _connection = value;
        }

        public function get theta():Number
        {
            return _theta;
        }

        public function set theta(value:Number):void
        {
            _theta = value;
        }
        
        public function debugPrint():void
        {
            var info:String = "Constrain " + name + "("
                + (_node==null?null:_node.name) + ", " 
                + (_connection==null?null:_connection.name) + ", " 
                + _theta + ")";
            trace (info);
        }


    }
}